<template>
  <div class="common-layout">
    <el-container>
      <el-header>
        <div class="headerleft">
          <img :src="pic1" alt="" />
          <span>云购物后台管理系统</span>
        </div>
        <div class="headerright">
          <el-dropdown>
            <span class="el-dropdown-link">
              <img :src="pic" alt="" />
            </span>
            <template #dropdown>
              <el-dropdown-menu>
                <el-dropdown-item @click="pushPerson"
                  >个人中心</el-dropdown-item
                >
                <el-dropdown-item @click="exit">退出</el-dropdown-item>
              </el-dropdown-menu>
            </template>
          </el-dropdown>
        </div>
      </el-header>
      <el-container>
        <el-aside width="auto">
          <Aside />
        </el-aside>
        <el-main >
          <RouterView />
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script setup>
import pic from "../assets/icon.png";
import pic1 from "../assets/logo.png";
import { useRouter } from "vue-router";
import Aside from "../components/Aside.vue";
var $router = useRouter();
var exit = () => {
  localStorage.removeItem("token");
  $router.push("/login");
};
var pushPerson = () => {
  $router.push("/index/person");
};
</script>

<style lang="scss" scoped>
html,
body {
  height: 100vh;
  overflow:hidden;
}

.el-header {
  background: #373c40;
  padding-left: 0;
  color: white;
  display: flex;
  height: 70px;
  justify-content: space-between;
  align-items: center;
  .headerleft {
    // width: 400px;
    display: flex;
    // text-align: right;
    margin-left: 10px;
    align-items: center;
    img {
      width: 10%;
    }
    span {
      font-weight: bolder;
      margin-left: 20px;
    }
  }
  .headerright {
    text-align: center;
    margin-right: 200px;
    img {
      width: 30px;
      height: 30px;
      border-radius: 50%;
    }
  }
}
.el-container {
  height: 100vh;
}
</style>